package com.zivwu.library.ui.image;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.zivwu.library.dao.bean.Photo;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RunWith(AndroidJUnit4.class)
public class MediaStoreHelperTest {
    private MediaStoreHelper helper;

    @Before
    public void init() {
        Context context = InstrumentationRegistry.getTargetContext();
        helper = new MediaStoreHelper(context);
    }


    @Test
    public void testGetPhoto() throws Exception {
//        String selection = "0=0) group by ( ?";
//        String[] selectionArgs = {MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME};
//        String selection = MediaStore.Images.ImageColumns.MIME_TYPE+"=?"
//                + " OR "
//                +MediaStore.Images.ImageColumns.MIME_TYPE+"=?";
//        String[] selectionArgs = {"image/jpeg","image/png"};
//        String sortOrder = MediaStore.Images.ImageColumns.DATE_MODIFIED + " desc";
//        helper.selectPhotos(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection, selectionArgs, sortOrder);

        ArrayList<Map.Entry<String, List<Photo>>> lists = helper.getPhotosByModifiedDesc();
        Map.Entry<String, List<Photo>> entry = lists.get(0);


    }


}